<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数据中心</title>
    <script type="text/javascript" src="/static/Js/jQuery-3.5.1.js"></script>
    <script type="text/javascript" src="/static/Js/socket.io.js"></script>
    <script type="text/javascript" src="/static/Js/bootstrap/popper.js"></script>
    <script type="text/javascript" src="/static/Js/bootstrap/bootstrap-table.min.js"></script>
    <script type="text/javascript" src="/static/Js/bootstrap/bootstrap-table-zh-CN.min.js"></script>
    <script type="text/javascript" src="/static/Js/bootstrap/bootstrap.min.js"></script>
    <script type="text/javascript" src="/static/Js/GetUserParam.js"></script>
    <script type="text/javascript" src="/static/Js/UserFullNameWaterMark.js"></script>
    <script type="text/javascript" src="/static/Js/watermark.js"></script>
    <script type="text/javascript" src="/static/Js/bootstrap/bootstrap-switch.min.js"></script>
    <script type="text/javascript" src="/static/Js/CalculationIsType.js"></script>
    <script type="text/javascript" src="/static/Js/Spot_check/DataCenterDataCount1.js"></script>



    <link rel="stylesheet" href="/static/Css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/Css/CommonStyles.css">
    <link rel="stylesheet" href="/static/Css/bootstrap-switch.min.css">
    <link rel="stylesheet" href="/static/Css/TableCommonStyles.css">

</head>
<body style="overflow: auto" id="bg_body">
<div id="modalDiv"></div>
<div id="headDiv"></div>
<div class="actionBar" id="actionBar">
    <nav style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="#">台账信息</a></li>
            <li class="breadcrumb-item">
                <div class="btn-group dropright">
                    <button type="button" id="dropdown" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">

                    </button>
                <div class="dropdown-menu" id="dropdown-menu">

                </div>
                </div>
            </li>
        </ol>
    </nav>
</div>

<div class="modal fade" id="exampleModal01" tabindex="-1" aria-labelledby="exampleModalLabel01" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel01">删除确认</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body" id="deleteMsg">

            </div>
            <div class="modal-footer">
                <button type="button" id="modalCancelBtn" onclick="setDeleteFlag(false)" class="btn btn-secondary" data-dismiss="modal">取消</button>
                <button type="button" style="width: auto" id="modalOkBtn" onclick="setDeleteFlag(true)" data-dismiss="modal" class="btn btn-primary">确认</button>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $("#exampleModal01").modal("hide")
        getDatacenterNav()
    })
    function getPageUrl() {
        return window.location.pathname
    }
    /**导入头部
     * */
    $.get('HeadPage.html',function(data){
        $("#headDiv").html(data)
    })
    /**导入消息提示
     * */
    $.get("Toasts.html",function (data){
        $("#ToastsPage").html(data)
    })
    /**导入错误提示
     * */
    $.get("/templates/CommonModal.html",function (data) {
        $("#modalDiv").html(data)
    })


    function getDatacenterNav() {
        $.post("/dataCenter/getDataCenterSideBar",{},function (result) {
            if (result.flag) {
                let i = 0;
                for (const resultElement of result.data) {
                    let element = document.createElement("div")
                    element.className = "menuSpan"
                    element.setAttribute("id",resultElement.htmlid)
                    element.setAttribute("onclick",resultElement.fun)
                    element.innerHTML = resultElement.context
                    let parentElement = document.getElementById("dropdown-menu")
                    parentElement.appendChild(element)
                    if (i === 0) {
                        if (resultElement.id === 1) {
                            dataCount1(element)
                        }else if (resultElement.id === 2) {
                            dataCount2(element)
                        }
                    }
                    i++
                }

            }else {

            }
        })
    }


    function dataCount2(obj) {
        document.getElementById("dropdown").innerHTML = document.getElementById(obj.id).innerHTML
        scDataIdIndex = 0
        getS_CDailyData(1)
    }
    function gotoDailyPage(page,tableType) {
        switch (tableType){
            case 1:getS_CDailyData(page);
                break;
            case 2:searchBarBtnGetData(groupOption,point_name,page);
                break;
        }

    }
    function getS_CDailyData(page) {


        $.post("/dataCenter/getS_CDailyData",{page:page},function (result) {
            if (result.flag){

                scDailyDataTableTemplate(result,1)
                document.getElementById("modalCancelBtn").setAttribute("onclick","setDeleteFlag(false)")
                document.getElementById("modalOkBtn").setAttribute("onclick","setDeleteFlag(true)")
                document.getElementById("errBar").style.visibility = "visible"
                document.getElementById("errBar").innerHTML = "日常点检总表"
            }else {
                $("#context").remove()
                $("#pageBar_nav").remove()
                $("#searchBar").remove()
                $("#errBar").remove()
                /*errBar*/
                let errBar_Div = document.createElement("div")
                errBar_Div.setAttribute("id","errBar")
                errBar_Div.className = "errBar"
                errBar_Div.innerHTML = "占位"
                errBar_Div.style.visibility = "hidden"
                document.getElementById("bg_body").appendChild(errBar_Div)
                document.getElementById("errBar").style.visibility = "visible"
                document.getElementById("errBar").innerHTML = result.errorMsg
                document.getElementById("modalCancelBtn").setAttribute("onclick","setDeleteFlag(false)")
                document.getElementById("modalOkBtn").setAttribute("onclick","setDeleteFlag(true)")
            }
        })
    }
    function scDailyDataTableTemplate(result,tableType,timeType) {
        $("#context").remove()
        $("#pageBar_nav").remove()
        $("#searchBar").remove()
        $("#errBar").remove()

        let searchBar_Div = document.createElement("div")
        searchBar_Div.className = "searchBar"
        searchBar_Div.setAttribute("id","searchBar")
        let searchBar_Div_nav = document.createElement("nav")

        let searchBar_Div_nav_ol = document.createElement("ol")
        searchBar_Div_nav_ol.className = "breadcrumb"

        let searchBar_Div_nav_ol_li1 = document.createElement("li")
        searchBar_Div_nav_ol_li1.className = "searchBar_li"

        let searchBar_Div_nav_ol_li_button1 = document.createElement("button")
        searchBar_Div_nav_ol_li_button1.className = "btn btn-primary searchBarBtn"
        searchBar_Div_nav_ol_li_button1.setAttribute("type","button")
        searchBar_Div_nav_ol_li_button1.setAttribute("onclick","searchBarBtn()")
        searchBar_Div_nav_ol_li_button1.innerHTML = "条件查找"

        searchBar_Div_nav_ol_li1.appendChild(searchBar_Div_nav_ol_li_button1)

        let searchBar_Div_nav_ol_li2 = document.createElement("li")
        searchBar_Div_nav_ol_li2.className = "searchBar_li"

        let searchBar_Div_nav_ol_li_input2 = document.createElement("input")
        searchBar_Div_nav_ol_li_input2.className = "form-control searchBarInput"
        searchBar_Div_nav_ol_li_input2.setAttribute("type","text")
        searchBar_Div_nav_ol_li_input2.setAttribute("id","searchBarInput")
        searchBar_Div_nav_ol_li_input2.setAttribute("placeholder","查找点位名")

        searchBar_Div_nav_ol_li2.appendChild(searchBar_Div_nav_ol_li_input2)

        let searchBar_Div_nav_ol_li3 = document.createElement("li")
        searchBar_Div_nav_ol_li3.className = "searchBar_li"

        let searchBar_Div_nav_ol_li3_select = document.createElement("select")
        searchBar_Div_nav_ol_li3_select.className = "custom-select searchBarInput searchBarSelect"
        searchBar_Div_nav_ol_li3_select.setAttribute("id","pram_select_01")

        let searchBar_Div_nav_ol_li3_select_option1 = document.createElement("option")
        searchBar_Div_nav_ol_li3_select_option1.setAttribute("selected","")
        searchBar_Div_nav_ol_li3_select_option1.setAttribute("disabled","")
        searchBar_Div_nav_ol_li3_select_option1.setAttribute("hidden","")
        searchBar_Div_nav_ol_li3_select_option1.innerText = "根据状态查询"


        searchBar_Div_nav_ol_li3_select.appendChild(searchBar_Div_nav_ol_li3_select_option1)

        let s_CDailyStatus = GetS_CDailyStatus()
        for (const s_CDailyStatusElement of s_CDailyStatus) {
            let searchBar_Div_nav_ol_li3_select_option2 = document.createElement("option")
            searchBar_Div_nav_ol_li3_select_option2.setAttribute("value",s_CDailyStatusElement.status)
            searchBar_Div_nav_ol_li3_select_option2.innerText = s_CDailyStatusElement.statusAlias
            searchBar_Div_nav_ol_li3_select.appendChild(searchBar_Div_nav_ol_li3_select_option2)
        }

        searchBar_Div_nav_ol_li3.appendChild(searchBar_Div_nav_ol_li3_select)

        searchBar_Div_nav_ol.appendChild(searchBar_Div_nav_ol_li1)
        searchBar_Div_nav_ol.appendChild(searchBar_Div_nav_ol_li2)
        searchBar_Div_nav_ol.appendChild(searchBar_Div_nav_ol_li3)

        searchBar_Div_nav.appendChild(searchBar_Div_nav_ol)
        searchBar_Div.appendChild(searchBar_Div_nav)

        /*errBar*/
        let errBar_Div = document.createElement("div")
        errBar_Div.setAttribute("id","errBar")
        errBar_Div.className = "errBar"
        errBar_Div.innerHTML = "占位"
        errBar_Div.style.visibility = "hidden"

        let pageBar_nav = document.createElement("nav")
        pageBar_nav.setAttribute("aria-label","Page navigation example")
        pageBar_nav.className = "pageBar_nav"
        pageBar_nav.setAttribute("id","pageBar_nav")

        let pageBar_ul = document.createElement("ul")
        pageBar_ul.setAttribute("class","pagination")

        if (result.data.currentPage === 1 || result.data.currentPage < 0) {
            let pageBar_ul_li1 = document.createElement("li")
            pageBar_ul_li1.className = "page-item disabled "

            let pageBar_ul_li_a1 = document.createElement("a")
            pageBar_ul_li_a1.className = "page-link"
            pageBar_ul_li_a1.setAttribute("href","#")
            pageBar_ul_li_a1.setAttribute("aria-label","Previous")

            let pageBar_ul_li_a_span1 = document.createElement("span")
            pageBar_ul_li_a_span1.setAttribute("aria-hidden","true")
            pageBar_ul_li_a_span1.innerHTML = "&laquo;"

            pageBar_ul_li_a1.appendChild(pageBar_ul_li_a_span1)
            pageBar_ul_li1.appendChild(pageBar_ul_li_a1)
            pageBar_ul.appendChild(pageBar_ul_li1)
        }else {
            let pageBar_ul_li1 = document.createElement("li")
            pageBar_ul_li1.className = "page-item"
            pageBar_ul_li1.setAttribute("onclick","gotoDailyPage("+1+","+tableType+")")

            let pageBar_ul_li_a1 = document.createElement("a")
            pageBar_ul_li_a1.className = "page-link"
            pageBar_ul_li_a1.setAttribute("href","#")
            pageBar_ul_li_a1.setAttribute("aria-label","Previous")

            let pageBar_ul_li_a_span1 = document.createElement("span")
            pageBar_ul_li_a_span1.setAttribute("aria-hidden","true")
            pageBar_ul_li_a_span1.innerHTML = "&laquo;"

            pageBar_ul_li_a1.appendChild(pageBar_ul_li_a_span1)
            pageBar_ul_li1.appendChild(pageBar_ul_li_a1)
            pageBar_ul.appendChild(pageBar_ul_li1)
        }

        if (result.data.currentPage > 5 && result.data.currentPage < result.data.totalPage - 4) {
            for (let i = result.data.currentPage - 5; i < result.data.currentPage + 5; i++) {
                if (result.data.currentPage === (i + 1)) {
                    let pageBar_ul_li = document.createElement("li")
                    pageBar_ul_li.className = "page-item active"

                    let pageBar_ul_li_a = document.createElement("a")
                    pageBar_ul_li_a.className = "page-link"
                    pageBar_ul_li_a.setAttribute("href", "#")
                    pageBar_ul_li_a.innerHTML = (i + 1)
                    pageBar_ul_li.appendChild(pageBar_ul_li_a)
                    pageBar_ul.appendChild(pageBar_ul_li)
                } else {
                    let pageBar_ul_li = document.createElement("li")
                    pageBar_ul_li.className = "page-item"
                    pageBar_ul_li.setAttribute("onclick", "gotoDailyPage(" + (i + 1) + "," + tableType + ")")
                    let pageBar_ul_li_a = document.createElement("a")
                    pageBar_ul_li_a.className = "page-link"
                    pageBar_ul_li_a.setAttribute("href", "#")
                    pageBar_ul_li_a.innerHTML = (i + 1)
                    pageBar_ul_li.appendChild(pageBar_ul_li_a)
                    pageBar_ul.appendChild(pageBar_ul_li)
                }

            }
        }else {
            if (result.data.currentPage <= 5){
                for (let i = 0; i < 10; i++) {
                    if (result.data.currentPage === (i + 1)) {
                        let pageBar_ul_li = document.createElement("li")
                        pageBar_ul_li.className = "page-item active"

                        let pageBar_ul_li_a = document.createElement("a")
                        pageBar_ul_li_a.className = "page-link"
                        pageBar_ul_li_a.setAttribute("href", "#")
                        pageBar_ul_li_a.innerHTML = (i + 1)
                        pageBar_ul_li.appendChild(pageBar_ul_li_a)
                        pageBar_ul.appendChild(pageBar_ul_li)
                    } else {
                        let pageBar_ul_li = document.createElement("li")
                        pageBar_ul_li.className = "page-item"
                        pageBar_ul_li.setAttribute("onclick", "gotoDailyPage(" + (i + 1) + "," + tableType + ")")
                        let pageBar_ul_li_a = document.createElement("a")
                        pageBar_ul_li_a.className = "page-link"
                        pageBar_ul_li_a.setAttribute("href", "#")
                        pageBar_ul_li_a.innerHTML = (i + 1)
                        pageBar_ul_li.appendChild(pageBar_ul_li_a)
                        pageBar_ul.appendChild(pageBar_ul_li)
                    }

                }
            }
            if (result.data.currentPage >= result.data.totalPage - 4){
                for (let i = result.data.totalPage - 10; i < result.data.totalPage; i++) {
                    if (result.data.currentPage === (i + 1)) {
                        let pageBar_ul_li = document.createElement("li")
                        pageBar_ul_li.className = "page-item active"

                        let pageBar_ul_li_a = document.createElement("a")
                        pageBar_ul_li_a.className = "page-link"
                        pageBar_ul_li_a.setAttribute("href", "#")
                        pageBar_ul_li_a.innerHTML = (i + 1)
                        pageBar_ul_li.appendChild(pageBar_ul_li_a)
                        pageBar_ul.appendChild(pageBar_ul_li)
                    } else {
                        let pageBar_ul_li = document.createElement("li")
                        pageBar_ul_li.className = "page-item"
                        pageBar_ul_li.setAttribute("onclick", "gotoDailyPage(" + (i + 1) + "," + tableType + ")")
                        let pageBar_ul_li_a = document.createElement("a")
                        pageBar_ul_li_a.className = "page-link"
                        pageBar_ul_li_a.setAttribute("href", "#")
                        pageBar_ul_li_a.innerHTML = (i + 1)
                        pageBar_ul_li.appendChild(pageBar_ul_li_a)
                        pageBar_ul.appendChild(pageBar_ul_li)
                    }

                }
            }
        }
        let pageBar_ul_li2
        let pageBar_ul_li_a2
        let pageBar_ul_li_a_span2
        if (result.data.currentPage === result.data.totalPage || result.data.currentPage > result.data.totalPage) {
            pageBar_ul_li2 = document.createElement("li")
            pageBar_ul_li2.className = "page-item disabled"

            pageBar_ul_li_a2 = document.createElement("a")
            pageBar_ul_li_a2.className = "page-link"
            pageBar_ul_li_a2.setAttribute("href","#")
            pageBar_ul_li_a2.setAttribute("aria-label","Next")

            pageBar_ul_li_a_span2 = document.createElement("span")
            pageBar_ul_li_a_span2.setAttribute("aria-hidden","true")
            pageBar_ul_li_a_span2.innerHTML = "&raquo;"
        }else {
            pageBar_ul_li2 = document.createElement("li")
            pageBar_ul_li2.className = "page-item"
            pageBar_ul_li2.setAttribute("onclick","gotoDailyPage("+result.data.totalPage+","+tableType+")")
            pageBar_ul_li_a2 = document.createElement("a")
            pageBar_ul_li_a2.className = "page-link"
            pageBar_ul_li_a2.setAttribute("href","#")
            pageBar_ul_li_a2.setAttribute("aria-label","Next")

            pageBar_ul_li_a_span2 = document.createElement("span")
            pageBar_ul_li_a_span2.setAttribute("aria-hidden","true")
            pageBar_ul_li_a_span2.innerHTML = "&raquo;"

        }


        let contextSpan = document.createElement("span")
        contextSpan.innerHTML = "共计"+ result.data.totalCurrent +"条数据"+'&nbsp;&nbsp;&nbsp;'+result.data.totalPage+"页"
        contextSpan.className = "contextSpan"



        pageBar_ul_li_a2.appendChild(pageBar_ul_li_a_span2)
        pageBar_ul_li2.appendChild(pageBar_ul_li_a2)
        pageBar_ul.appendChild(pageBar_ul_li2)
        pageBar_ul.appendChild(contextSpan)

        let tableEle = document.createElement("table")
        tableEle.setAttribute("id","pointTable")
        let theadEle = document.createElement("thead")
        let theadTr = document.createElement("tr")

        let contextDiv = document.createElement("div")
        contextDiv.setAttribute("id","context")




        let thEle_date = document.createElement("th")
        thEle_date.innerHTML = "日期"
        let thEle_pointName = document.createElement("th")
        thEle_pointName.innerHTML = "点检点位名"
        let thEle_ID = document.createElement("th")
        thEle_ID.innerHTML = "ID"
        let thEle_status = document.createElement("th")
        thEle_status.innerHTML = "状态"


        let thEle_action = document.createElement("th")
        thEle_action.innerHTML = "操作"


        theadTr.appendChild(thEle_ID)
        theadTr.appendChild(thEle_pointName)
        theadTr.appendChild(thEle_date)
        theadTr.appendChild(thEle_status)
        theadTr.appendChild(thEle_action)

        theadEle.appendChild(theadTr)
        tableEle.appendChild(theadEle)


        let tbody = document.createElement("tbody")


        let index = 0
        for (const datum of result.data.records) {
            index++



            let tbodyTr = document.createElement("tr")



            let trTd_date = document.createElement("td")
            trTd_date.setAttribute("id","date"+index)
            trTd_date.innerHTML = new Date(datum.date).toLocaleDateString()


            let trTd_pointName = document.createElement("td")
            trTd_pointName.innerHTML = datum.point
            trTd_pointName.setAttribute("id","pointName"+index)
            /*trTd_pointName.setAttribute("ondblclick","pointNameEdit(this,"+index+")")*/
            let trTd_ID = document.createElement("td")
            trTd_ID.innerHTML = index
            let trTd_status = document.createElement("td")
            let statusOk = document.createElement("span")
            statusOk.className = "statusPoint statusPointProper"
            let statusOkContext = document.createElement("span")
            statusOkContext.className = "statusContext"
            statusOkContext.innerHTML = "正常"
            statusOk.appendChild(statusOkContext)

            let statusEx = document.createElement("span")
            statusEx.className = "statusPoint statusPointException"
            let statusExContext = document.createElement("span")
            statusExContext.className = "statusContext"
            statusExContext.innerHTML = "异常"
            statusEx.appendChild(statusExContext)
            if (datum.statusFlag){
                trTd_status.appendChild(statusOk)
            }else {
                trTd_status.appendChild(statusEx)
            }



            let trTd_action = document.createElement("td")
            let trDailyEle = document.createElement("a")
            trDailyEle.innerHTML = "详细"
            trDailyEle.className = "DailyEle"
            trDailyEle.setAttribute("id","DailyEle" + index)
            trDailyEle.setAttribute("onclick","s_cDataDailyEle("+index+",1)")



            trTd_action.appendChild(trDailyEle)


            tbodyTr.appendChild(trTd_ID)
            tbodyTr.appendChild(trTd_pointName)
            tbodyTr.appendChild(trTd_date)
            tbodyTr.appendChild(trTd_status)

            tbodyTr.appendChild(trTd_action)

            tbody.appendChild(tbodyTr)

        }
        tableEle.appendChild(tbody)
        contextDiv.appendChild(tableEle)
        pageBar_nav.appendChild(pageBar_ul)

        document.getElementById("bg_body").appendChild(searchBar_Div)
        document.getElementById("bg_body").appendChild(errBar_Div)
        document.getElementById("bg_body").appendChild(contextDiv)
        document.getElementById("bg_body").appendChild(pageBar_nav)

    }


    let S_CDataTimeFlag
    function scDailyStatusDataTableTemplate(result,tableType) {

        result1 = ''
        tbody1 = ''
        index2 =''
        searchBar_Div1=''
        errBar_Div1=''
        contextDiv1=''
        pageBar_nav1=''
        tableEle1=''
        pageBar_ul1=''

        $("#context").remove()
        $("#pageBar_nav").remove()
        $("#searchBar").remove()
        $("#errBar").remove()

        let searchBar_Div = document.createElement("div")
        searchBar_Div.className = "searchBar"
        searchBar_Div.setAttribute("id","searchBar")
        let searchBar_Div_nav = document.createElement("nav")

        let searchBar_Div_nav_ol = document.createElement("ol")
        searchBar_Div_nav_ol.className = "breadcrumb"

        let searchBar_Div_nav_ol_li1 = document.createElement("li")
        searchBar_Div_nav_ol_li1.className = "searchBar_li"

        let searchBar_Div_nav_ol_li_button1 = document.createElement("button")
        searchBar_Div_nav_ol_li_button1.className = "btn btn-primary searchBarBtn"
        searchBar_Div_nav_ol_li_button1.setAttribute("type","button")
        searchBar_Div_nav_ol_li_button1.setAttribute("onclick","getS_CDailyData(1)")
        searchBar_Div_nav_ol_li_button1.innerHTML = "返回"

        searchBar_Div_nav_ol_li1.appendChild(searchBar_Div_nav_ol_li_button1)


        let searchBar_Div_nav_ol_li4 = document.createElement("li")
        searchBar_Div_nav_ol_li4.className = "searchBar_li"

        let searchBar_Div_nav_ol_li3_select2 = document.createElement("select")
        searchBar_Div_nav_ol_li3_select2.className = "custom-select searchBarInput searchBarSelect"
        searchBar_Div_nav_ol_li3_select2.setAttribute("id","pram_select_03")
        searchBar_Div_nav_ol_li3_select2.setAttribute("onchange","switchS_CTime()")

        let searchBar_Div_nav_ol_li3_select_option_mo = document.createElement("option")
        searchBar_Div_nav_ol_li3_select_option_mo.innerText = "早班"

        let searchBar_Div_nav_ol_li3_select_option_mi = document.createElement("option")
        searchBar_Div_nav_ol_li3_select_option_mi.innerText = "中班"


        searchBar_Div_nav_ol_li3_select2.appendChild(searchBar_Div_nav_ol_li3_select_option_mo)
        searchBar_Div_nav_ol_li3_select2.appendChild(searchBar_Div_nav_ol_li3_select_option_mi)



        searchBar_Div_nav_ol_li4.appendChild(searchBar_Div_nav_ol_li3_select2)
        searchBar_Div_nav_ol.appendChild(searchBar_Div_nav_ol_li1)

        searchBar_Div_nav_ol.appendChild(searchBar_Div_nav_ol_li4)
        searchBar_Div_nav.appendChild(searchBar_Div_nav_ol)
        searchBar_Div.appendChild(searchBar_Div_nav)

        /*errBar*/
        let errBar_Div = document.createElement("div")
        errBar_Div.setAttribute("id","errBar")
        errBar_Div.className = "errBar"
        errBar_Div.innerHTML = "占位"
        errBar_Div.style.visibility = "hidden"

        let pageBar_nav = document.createElement("nav")
        pageBar_nav.setAttribute("aria-label","Page navigation example")
        pageBar_nav.className = "pageBar_nav"
        pageBar_nav.setAttribute("id","pageBar_nav")

        let pageBar_ul = document.createElement("ul")
        pageBar_ul.setAttribute("class","pagination")

        if (result.data.currentPage === 1 || result.data.currentPage < 0) {
            let pageBar_ul_li1 = document.createElement("li")
            pageBar_ul_li1.className = "page-item disabled "

            let pageBar_ul_li_a1 = document.createElement("a")
            pageBar_ul_li_a1.className = "page-link"
            pageBar_ul_li_a1.setAttribute("href","#")
            pageBar_ul_li_a1.setAttribute("aria-label","Previous")

            let pageBar_ul_li_a_span1 = document.createElement("span")
            pageBar_ul_li_a_span1.setAttribute("aria-hidden","true")
            pageBar_ul_li_a_span1.innerHTML = "&laquo;"

            pageBar_ul_li_a1.appendChild(pageBar_ul_li_a_span1)
            pageBar_ul_li1.appendChild(pageBar_ul_li_a1)
            pageBar_ul.appendChild(pageBar_ul_li1)
        }else {
            let pageBar_ul_li1 = document.createElement("li")
            pageBar_ul_li1.className = "page-item"
            pageBar_ul_li1.setAttribute("onclick","gotoDailyPage("+1+","+tableType+")")

            let pageBar_ul_li_a1 = document.createElement("a")
            pageBar_ul_li_a1.className = "page-link"
            pageBar_ul_li_a1.setAttribute("href","#")
            pageBar_ul_li_a1.setAttribute("aria-label","Previous")

            let pageBar_ul_li_a_span1 = document.createElement("span")
            pageBar_ul_li_a_span1.setAttribute("aria-hidden","true")
            pageBar_ul_li_a_span1.innerHTML = "&laquo;"

            pageBar_ul_li_a1.appendChild(pageBar_ul_li_a_span1)
            pageBar_ul_li1.appendChild(pageBar_ul_li_a1)
            pageBar_ul.appendChild(pageBar_ul_li1)
        }

        if (result.data.current > 5 && result.data.current < result.data.pages - 4) {
            for (let i = result.data.current - 5; i < result.data.current + 5; i++) {
                if (result.data.current === (i + 1)) {
                    let pageBar_ul_li = document.createElement("li")
                    pageBar_ul_li.className = "page-item active"

                    let pageBar_ul_li_a = document.createElement("a")
                    pageBar_ul_li_a.className = "page-link"
                    pageBar_ul_li_a.setAttribute("href", "#")
                    pageBar_ul_li_a.innerHTML = (i + 1)
                    pageBar_ul_li.appendChild(pageBar_ul_li_a)
                    pageBar_ul.appendChild(pageBar_ul_li)
                } else {
                    let pageBar_ul_li = document.createElement("li")
                    pageBar_ul_li.className = "page-item"
                    pageBar_ul_li.setAttribute("onclick", "gotoDailyPage(" + (i + 1) + "," + tableType + ")")
                    let pageBar_ul_li_a = document.createElement("a")
                    pageBar_ul_li_a.className = "page-link"
                    pageBar_ul_li_a.setAttribute("href", "#")
                    pageBar_ul_li_a.innerHTML = (i + 1)
                    pageBar_ul_li.appendChild(pageBar_ul_li_a)
                    pageBar_ul.appendChild(pageBar_ul_li)
                }

            }
        }else {
            if (result.data.current <= 5){
                if (result.data.pages < 10) {
                    for (let i = 0; i < result.data.pages; i++) {
                        if (result.data.current === (i + 1)) {
                            let pageBar_ul_li = document.createElement("li")
                            pageBar_ul_li.className = "page-item active"

                            let pageBar_ul_li_a = document.createElement("a")
                            pageBar_ul_li_a.className = "page-link"
                            pageBar_ul_li_a.setAttribute("href", "#")
                            pageBar_ul_li_a.innerHTML = (i + 1)
                            pageBar_ul_li.appendChild(pageBar_ul_li_a)
                            pageBar_ul.appendChild(pageBar_ul_li)
                        } else {
                            let pageBar_ul_li = document.createElement("li")
                            pageBar_ul_li.className = "page-item"
                            pageBar_ul_li.setAttribute("onclick", "gotoDailyPage(" + (i + 1) + "," + tableType + ")")
                            let pageBar_ul_li_a = document.createElement("a")
                            pageBar_ul_li_a.className = "page-link"
                            pageBar_ul_li_a.setAttribute("href", "#")
                            pageBar_ul_li_a.innerHTML = (i + 1)
                            pageBar_ul_li.appendChild(pageBar_ul_li_a)
                            pageBar_ul.appendChild(pageBar_ul_li)
                        }

                    }
                }else {
                    for (let i = 0; i < 10; i++) {
                        if (result.data.current === (i + 1)) {
                            let pageBar_ul_li = document.createElement("li")
                            pageBar_ul_li.className = "page-item active"

                            let pageBar_ul_li_a = document.createElement("a")
                            pageBar_ul_li_a.className = "page-link"
                            pageBar_ul_li_a.setAttribute("href", "#")
                            pageBar_ul_li_a.innerHTML = (i + 1)
                            pageBar_ul_li.appendChild(pageBar_ul_li_a)
                            pageBar_ul.appendChild(pageBar_ul_li)
                        } else {
                            let pageBar_ul_li = document.createElement("li")
                            pageBar_ul_li.className = "page-item"
                            pageBar_ul_li.setAttribute("onclick", "gotoDailyPage(" + (i + 1) + "," + tableType + ")")
                            let pageBar_ul_li_a = document.createElement("a")
                            pageBar_ul_li_a.className = "page-link"
                            pageBar_ul_li_a.setAttribute("href", "#")
                            pageBar_ul_li_a.innerHTML = (i + 1)
                            pageBar_ul_li.appendChild(pageBar_ul_li_a)
                            pageBar_ul.appendChild(pageBar_ul_li)
                        }

                    }
                }
            } else if (result.data.current >= result.data.pages - 4){
                for (let i = result.data.pages - 10; i < result.data.pages; i++) {
                    if (result.data.current === (i + 1)) {
                        let pageBar_ul_li = document.createElement("li")
                        pageBar_ul_li.className = "page-item active"

                        let pageBar_ul_li_a = document.createElement("a")
                        pageBar_ul_li_a.className = "page-link"
                        pageBar_ul_li_a.setAttribute("href", "#")
                        pageBar_ul_li_a.innerHTML = (i + 1)
                        pageBar_ul_li.appendChild(pageBar_ul_li_a)
                        pageBar_ul.appendChild(pageBar_ul_li)
                    } else {
                        let pageBar_ul_li = document.createElement("li")
                        pageBar_ul_li.className = "page-item"
                        pageBar_ul_li.setAttribute("onclick", "gotoDailyPage(" + (i + 1) + "," + tableType + ")")
                        let pageBar_ul_li_a = document.createElement("a")
                        pageBar_ul_li_a.className = "page-link"
                        pageBar_ul_li_a.setAttribute("href", "#")
                        pageBar_ul_li_a.innerHTML = (i + 1)
                        pageBar_ul_li.appendChild(pageBar_ul_li_a)
                        pageBar_ul.appendChild(pageBar_ul_li)
                    }

                }
            }
        }
        let pageBar_ul_li2
        let pageBar_ul_li_a2
        let pageBar_ul_li_a_span2
        if (result.data.current === result.data.pages || result.data.current > result.data.pages) {
            pageBar_ul_li2 = document.createElement("li")
            pageBar_ul_li2.className = "page-item disabled"

            pageBar_ul_li_a2 = document.createElement("a")
            pageBar_ul_li_a2.className = "page-link"
            pageBar_ul_li_a2.setAttribute("href","#")
            pageBar_ul_li_a2.setAttribute("aria-label","Next")

            pageBar_ul_li_a_span2 = document.createElement("span")
            pageBar_ul_li_a_span2.setAttribute("aria-hidden","true")
            pageBar_ul_li_a_span2.innerHTML = "&raquo;"
        }else {
            pageBar_ul_li2 = document.createElement("li")
            pageBar_ul_li2.className = "page-item"
            pageBar_ul_li2.setAttribute("onclick","gotoDailyPage("+result.data.totalPage+","+tableType+")")
            pageBar_ul_li_a2 = document.createElement("a")
            pageBar_ul_li_a2.className = "page-link"
            pageBar_ul_li_a2.setAttribute("href","#")
            pageBar_ul_li_a2.setAttribute("aria-label","Next")

            pageBar_ul_li_a_span2 = document.createElement("span")
            pageBar_ul_li_a_span2.setAttribute("aria-hidden","true")
            pageBar_ul_li_a_span2.innerHTML = "&raquo;"

        }


        let contextSpan = document.createElement("span")
        contextSpan.innerHTML = "共计"+ result.data.total +"条数据"+'&nbsp;&nbsp;&nbsp;'+result.data.pages+"页"
        contextSpan.className = "contextSpan"



        pageBar_ul_li_a2.appendChild(pageBar_ul_li_a_span2)
        pageBar_ul_li2.appendChild(pageBar_ul_li_a2)
        pageBar_ul.appendChild(pageBar_ul_li2)
        pageBar_ul.appendChild(contextSpan)

        let tableEle = document.createElement("table")
        tableEle.setAttribute("id","pointTable")
        let theadEle = document.createElement("thead")
        let theadTr = document.createElement("tr")

        let contextDiv = document.createElement("div")
        contextDiv.setAttribute("id","context")



        let pointContent = document.createElement("th")
        pointContent.innerHTML = "点检项"



        let pointContentMorningUid = document.createElement("th")
        pointContentMorningUid.innerHTML = "责任人"


        let morningAuditUid = document.createElement("th")
        morningAuditUid.innerHTML = "日常点检审核"

        let pointContentMorningStatusId = document.createElement("th")
        pointContentMorningStatusId.innerHTML = "点检状态"

        let morningEXDescription = document.createElement("th")
        morningEXDescription.innerHTML = "异常信息"

        let morningExceptionCorrespondence = document.createElement("th")
        morningExceptionCorrespondence.innerHTML = "异常对应"


        let thEle_ID = document.createElement("th")
        thEle_ID.innerHTML = "ID"


        theadTr.appendChild(thEle_ID)
        theadTr.appendChild(pointContent)
        theadTr.appendChild(pointContentMorningUid)
        theadTr.appendChild(morningAuditUid)
        theadTr.appendChild(pointContentMorningStatusId)
        theadTr.appendChild(morningEXDescription)
        theadTr.appendChild(morningExceptionCorrespondence)

        theadEle.appendChild(theadTr)
        tableEle.appendChild(theadEle)





        let tbody = document.createElement("tbody")
        tbody.setAttribute("id","tbody")
        document.getElementById("bg_body").appendChild(searchBar_Div)
        document.getElementById("bg_body").appendChild(errBar_Div)
        let sc_time = document.getElementById("pram_select_03")
        let index1 = sc_time.selectedIndex
        let time1 = sc_time.options[index1].text
        let index = 0


        result1 = result;
        tbody1 = tbody
        index2 =index
        searchBar_Div1=searchBar_Div
        errBar_Div1=errBar_Div
        contextDiv1=contextDiv
        pageBar_nav1=pageBar_nav
        tableEle1=tableEle
        pageBar_ul1=pageBar_ul

       switchS_CTime();


    }
    let result1;
    let tbody1;
    let index2;
    let searchBar_Div1;
    let errBar_Div1;
    let contextDiv1;
    let pageBar_nav1;
    let tableEle1;
    let pageBar_ul1;

    function MiddayS_CData(result,tbody,index,searchBar_Div,errBar_Div,contextDiv,pageBar_nav,tableEle,pageBar_ul) {
        for (const datum of result.data.records) {
            index++
            let tbodyTr = document.createElement("tr")


            let trTd_date = document.createElement("td")
            trTd_date.setAttribute("id", "date" + index)
            trTd_date.innerHTML = new Date(datum.date).toLocaleDateString()


            let trTd_pointName = document.createElement("td")
            trTd_pointName.innerHTML = datum.pointContent
            trTd_pointName.setAttribute("id", "pointName" + index)
            trTd_pointName.setAttribute("ondblclick", "pointNameEdit(this," + index + ")")
            let trTd_ID = document.createElement("td")
            trTd_ID.innerHTML = index

            let s_cUid = document.createElement("td")
            s_cUid.innerHTML = datum.pointContentMiddayUid

            let morningAuditUid = document.createElement("td")
            morningAuditUid.innerHTML = datum.middayAuditUid

            let morningEXDescription = document.createElement("td")
            morningEXDescription.innerHTML = datum.middayEXDescription

            let morningExceptionCorrespondence = document.createElement("td")
            morningExceptionCorrespondence.innerHTML = datum.middayExceptionCorrespondence


            let trTd_status = document.createElement("td")
            let statusOk = document.createElement("span")
            statusOk.className = "statusPoint statusPointProper"
            let statusOkContext = document.createElement("span")
            statusOkContext.className = "statusContext"
            statusOkContext.innerHTML = "正常"
            statusOk.appendChild(statusOkContext)

            let statusEx = document.createElement("span")
            statusEx.className = "statusPoint statusPointException"
            let statusExContext = document.createElement("span")
            statusExContext.className = "statusContext"
            statusExContext.innerHTML = "异常"
            statusEx.appendChild(statusExContext)

            let statusNull = document.createElement("span")
            statusNull.className = "statusPoint"
            let statusNullContext = document.createElement("span")
            statusNullContext.className = "statusContext"
            statusNullContext.innerHTML = "未点检"
            statusNull.appendChild(statusNullContext)

            let statusBigEx = document.createElement("span")
            statusBigEx.className = "statusPoint statusPointException"
            let statusBigExContext = document.createElement("span")
            statusBigExContext.className = "statusContext"
            statusBigExContext.innerHTML = "重大异常"
            statusBigEx.appendChild(statusBigExContext)

            trTd_status.appendChild(statusNull)
            trTd_status.appendChild(statusOk)
            trTd_status.appendChild(statusEx)
            trTd_status.appendChild(statusBigEx)

            if (datum.pointContentMiddayStatusId === 0 || datum.pointContentMiddayStatusId === null) {
                statusNull.style.visibility = "visible"
                statusOk.style.visibility = "hidden"
                statusEx.style.visibility = "hidden"
                statusBigEx.style.visibility = "hidden"
            } else if (datum.pointContentMiddayStatusId === 1) {
                statusOk.style.visibility = "visible"
                statusNull.style.visibility = "hidden"

                statusEx.style.visibility = "hidden"
                statusBigEx.style.visibility = "hidden"
            } else if (datum.pointContentMiddayStatusId === 2) {
                statusEx.style.visibility = "visible"
                statusNull.style.visibility = "hidden"
                statusOk.style.visibility = "hidden"

                statusBigEx.style.visibility = "hidden"
            } else if (datum.pointContentMiddayStatusId === 3) {
                statusBigEx.style.visibility = "visible"
                statusNull.style.visibility = "hidden"
                statusOk.style.visibility = "hidden"
                statusEx.style.visibility = "hidden"

            }

            tbodyTr.appendChild(trTd_ID)
            tbodyTr.appendChild(trTd_pointName)
            tbodyTr.appendChild(s_cUid)
            tbodyTr.appendChild(morningAuditUid)
            tbodyTr.appendChild(s_cUid)
            tbodyTr.appendChild(trTd_status)
            tbodyTr.appendChild(morningEXDescription)
            tbodyTr.appendChild(morningExceptionCorrespondence)

            tbody.appendChild(tbodyTr)

        }
        tableEle.appendChild(tbody)
        contextDiv.appendChild(tableEle)
        pageBar_nav.appendChild(pageBar_ul)

        document.getElementById("bg_body").appendChild(searchBar_Div)
        document.getElementById("bg_body").appendChild(errBar_Div)
        document.getElementById("bg_body").appendChild(contextDiv)
        document.getElementById("bg_body").appendChild(pageBar_nav)
    }

    function MorningS_CData(result,tbody,index,searchBar_Div,errBar_Div,contextDiv,pageBar_nav,tableEle,pageBar_ul) {
        for (const datum of result.data.records) {
            index++
            let tbodyTr = document.createElement("tr")


            let trTd_date = document.createElement("td")
            trTd_date.setAttribute("id", "date" + index)
            trTd_date.innerHTML = new Date(datum.date).toLocaleDateString()


            let trTd_pointName = document.createElement("td")
            trTd_pointName.innerHTML = datum.pointContent
            trTd_pointName.setAttribute("id", "pointName" + index)
            trTd_pointName.setAttribute("ondblclick", "pointNameEdit(this," + index + ")")
            let trTd_ID = document.createElement("td")
            trTd_ID.innerHTML = index


            let s_cUser = GetUser(datum.pointContentMorningUid)

            let s_cUid = document.createElement("td")
            if (s_cUser != null){
                s_cUid.innerHTML = s_cUser.fullname
            }


            let morningAuditUidUser = GetUser(datum.morningAuditUid)
            let morningAuditUid = document.createElement("td")
            if (morningAuditUidUser != null){
                morningAuditUid.innerHTML = morningAuditUidUser.fullname
            }


            let morningEXDescription = document.createElement("td")
            morningEXDescription.innerHTML = datum.morningEXDescription
            let morningExceptionCorrespondenceUser = GetUser(datum.morningExceptionCorrespondence)

            let morningExceptionCorrespondence = document.createElement("td")
            if (morningExceptionCorrespondenceUser != null) {
                morningExceptionCorrespondence.innerHTML = morningExceptionCorrespondenceUser.fullname

            }


            let trTd_status = document.createElement("td")
            let statusOk = document.createElement("span")
            statusOk.className = "statusPoint statusPointProper"
            let statusOkContext = document.createElement("span")
            statusOkContext.className = "statusContext"
            statusOkContext.innerHTML = "正常"
            statusOk.appendChild(statusOkContext)

            let statusEx = document.createElement("span")
            statusEx.className = "statusPoint statusPointException"
            let statusExContext = document.createElement("span")
            statusExContext.className = "statusContext"
            statusExContext.innerHTML = "异常"
            statusEx.appendChild(statusExContext)

            let statusNull = document.createElement("span")
            statusNull.className = "statusPoint"
            let statusNullContext = document.createElement("span")
            statusNullContext.className = "statusContext"
            statusNullContext.innerHTML = "未点检"
            statusNull.appendChild(statusNullContext)

            let statusBigEx = document.createElement("span")
            statusBigEx.className = "statusPoint statusPointException"
            let statusBigExContext = document.createElement("span")
            statusBigExContext.className = "statusContext"
            statusBigExContext.innerHTML = "重大异常"
            statusBigEx.appendChild(statusBigExContext)

            trTd_status.appendChild(statusNull)
            trTd_status.appendChild(statusOk)
            trTd_status.appendChild(statusEx)
            trTd_status.appendChild(statusBigEx)

            if (datum.pointContentMorningStatusId === 0 || datum.pointContentMorningStatusId === null) {
                statusNull.style.visibility = "visible"
                statusOk.style.visibility = "hidden"
                statusEx.style.visibility = "hidden"
                statusBigEx.style.visibility = "hidden"
            } else if (datum.pointContentMorningStatusId === 1) {
                statusOk.style.visibility = "visible"
                statusNull.style.visibility = "hidden"

                statusEx.style.visibility = "hidden"
                statusBigEx.style.visibility = "hidden"
            } else if (datum.pointContentMorningStatusId === 2) {
                statusEx.style.visibility = "visible"
                statusNull.style.visibility = "hidden"
                statusOk.style.visibility = "hidden"

                statusBigEx.style.visibility = "hidden"
            } else if (datum.pointContentMorningStatusId === 3) {
                statusBigEx.style.visibility = "visible"
                statusNull.style.visibility = "hidden"
                statusOk.style.visibility = "hidden"
                statusEx.style.visibility = "hidden"

            }

            tbodyTr.appendChild(trTd_ID)
            tbodyTr.appendChild(trTd_pointName)
            tbodyTr.appendChild(s_cUid)
            tbodyTr.appendChild(morningAuditUid)
            tbodyTr.appendChild(s_cUid)
            tbodyTr.appendChild(trTd_status)
            tbodyTr.appendChild(morningEXDescription)
            tbodyTr.appendChild(morningExceptionCorrespondence)

            tbody.appendChild(tbodyTr)

        }
        tableEle.appendChild(tbody)
        contextDiv.appendChild(tableEle)
        pageBar_nav.appendChild(pageBar_ul)

        document.getElementById("bg_body").appendChild(searchBar_Div)
        document.getElementById("bg_body").appendChild(errBar_Div)
        document.getElementById("bg_body").appendChild(contextDiv)
        document.getElementById("bg_body").appendChild(pageBar_nav)
    }


    function ALLCustomSwitch(obj) {
        let arr_customSwitch = $("[id^='customSwitch']")
        let dailyS = $("[id^='DailyEle']")
        let DailyReviseEleS = $("[id^='DailyReviseEle']")
        if ($(obj).is(":checked") === true) {
            for (const daily of dailyS) {
                document.getElementById(daily.id).style.visibility = "hidden"
            }
            for (const dailyReviseEle of DailyReviseEleS) {
                document.getElementById(dailyReviseEle.id).style.visibility = "hidden"
            }
            for (const arrCustomSwitch of arr_customSwitch) {

                $("#"+arrCustomSwitch.id).prop("checked", true)
            }
        }else {
            for (const arrCustomSwitch of arr_customSwitch) {
                $("#"+arrCustomSwitch.id).prop("checked", false)
            }
            for (const daily of dailyS) {
                document.getElementById(daily.id).style.visibility = "visible"
            }
            for (const dailyReviseEle of DailyReviseEleS) {
                document.getElementById(dailyReviseEle.id).style.visibility = "visible"
            }
        }

    }

    function switchS_CTime() {
        let sc_time = document.getElementById("pram_select_03")
        let index1 = sc_time.selectedIndex
        let time1 = sc_time.options[index1].text
        $("#tbody").empty()
        if (time1 === "早班"){
            MorningS_CData(result1,tbody1,index2,searchBar_Div1,errBar_Div1,contextDiv1,pageBar_nav1,tableEle1,pageBar_ul1)
        }else if (time1 === "中班"){
            MiddayS_CData(result1,tbody1,index2,searchBar_Div1,errBar_Div1,contextDiv1,pageBar_nav1,tableEle1,pageBar_ul1)

        }

    }

    let s_cDataDailyEle_pointName
    let s_cDataDailyEle_date
    function s_cDataDailyEle(index,page) {
        S_CDataTimeFlag = true
        s_cDataDailyEle_pointName = ''
        s_cDataDailyEle_date = ''
        s_cDataDailyEle_pointName = document.getElementById("pointName"+index).innerText
        s_cDataDailyEle_date = document.getElementById("date"+index).innerText

        $.ajax({
            url:"/spot_check/getS_CDataStatus",
            type:"post",
            dataType:"json",
            data:{page:page,pointName:s_cDataDailyEle_pointName,date:s_cDataDailyEle_date},
            success:function (result){
                scDailyStatusDataTableTemplate(result,3)
            }
        })


    }


</script>
</body>
</html>
<!--tableType
区分表的种类
1：点位总表
2:搜索表

-->